Longest Increasing Subsequence
Medium
Question
Given a list of integers, find the length of the longest increasing subsequence (LIS) of numbers in it.
Input: nums = [2, 4, 6, 1, 4]
Output: 3
The longest increasing subsequence is [2, 4, 6].
Input: nums = [5, 3, 2]
Output: 1
The longest increasing subsequences are [5], [3], and [2].
Input: nums = [3, 10, 2, 1, 20]
Output: 3
The longest increasing subsequence is [3, 10, 20].
Clarify the problem
What are some questions you'd ask an interviewer?
Understand the problem
What is the longest increasing subsequence if given this list? nums = [50, 3, 10, 7, 40, 80]
1
2
3
4
Take a moment to understand the problem and think of your approach before you start coding.